package fei.zhou.lambdalearn.demo4;

import java.util.function.Consumer;

/**
 * 描述该类- JPA
 *
 * @author zhoufei
 * @class: Toshow
 * @date 2020/12/22 20:49
 * @Verson 1.0 -2020/12/22 20:49
 * @see
 */
public class Demo3 {
    public static void main(String[] args) {
        operatorString("ABC", (String s) -> {
            System.out.println(s.toLowerCase());
        });
        System.out.println("-----------");
        operatorString("ABC",
                (String s) -> {
            System.out.println(s + "转小写：" + s.toLowerCase());
        },
                (String s) -> {
            System.out.println("倒序：" + new StringBuilder(s).reverse().toString());
        });
    }
    // 定义一个方法，用不同的方式消费同一个字符串数据两次
    private static void operatorString(String name, Consumer<String> con1, Consumer<String> con2) {
        // con1.accept(name);
        // con2.accept(name);
        con1.andThen(con2).accept(name);
    }
    // 定义一个方法，消费一个字符串数据
    private static void operatorString(String name, Consumer<String> con) {
        con.accept(name);
    }
    
}